//
//  HLTusertitleCollectionViewCell.m
//  huiliantong
//
//  Created by hlt on 15/8/25.
//  Copyright (c) 2015年 hlt. All rights reserved.
//

#import "HLTusertitleCollectionViewCell.h"
#import "HLTzhanneixinTableViewController.h"
@implementation HLTusertitleCollectionViewCell

- (void)awakeFromNib {
    // Initialization code
    
//    [self initview];
    
    
    
}



-(void) initview
{
    Account *acc=[[AccountTool sharedAccountTool] currentAccount];
        NSString *usertype;
    if ([acc.custFlag isEqual:@"4"]) {
        usertype=@"您是 商户";
    }else
    {
        usertype=@"您是 注册用户";
    }
    
    
    
    self.usertype.text=usertype;
    self.userid.text=acc.custPhone;
    
    
    if ([acc.cardNo isEqual:@""]) {
//        self.yue.hidden=YES;
        self.yue.text=@"无汇支付卡";
        self.bangdingkahao.text=@"您未绑定汇联通卡号，请选择卡绑定功能进行绑定";
        
        
    }
    else{
        self.yue.text=acc.YKTCardBalance;
        
        self.bangdingkahao.text= [NSString stringWithFormat:@"绑定卡号：%@",acc.cardNo];
    }
    
    
    
    
}



- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        // 初始化时加载collectionCell.xib文件 这个是把这个xib文件全部加载了，然后取第一个
        NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"HLTusertitleCollectionViewCell" owner:self options:nil];
        
        // 如果路径不存在，return nil
        if (arrayOfViews.count < 1)
        {
            return nil;
        }
        // 如果xib中view不属于UICollectionViewCell类，return nil
        if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UICollectionViewCell class]])
        {
            return nil;
        }
        // 加载nib
        self = [arrayOfViews objectAtIndex:0];
    }
    return self;
}


//- (IBAction)cancel:(id)sender {
//    
//    
//    
//    Account *acc=[[AccountTool sharedAccountTool] currentAccount];
//    
//    //退出登录
//    [[AccountTool sharedAccountTool] tuichu:acc];
//    
//    [self.parent viewWillDisappear:YES];
//    [self.parent viewWillAppear:YES];
//    
//    
//    
//    
//}



//跳转到消息界面
- (IBAction)xiaoxi:(id)sender {
    
    
    Account *acc=[[AccountTool sharedAccountTool ]currentAccount];
    NSString *url=[myfriend stringByAppendingFormat:@"&username=%@",acc.custPhone];
    //将url转换一下格式，否则请求的格式就不兼容
    //    url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
    [HLTNetWorkingtool getary:url success:^(NSArray *ary) {
//        HLTFriendsTableViewController *vc=[[HLTFriendsTableViewController alloc]init];
//        vc.friendlist=ary;
//        vc.parent=self.parent;
//        [self.parent.navigationController pushViewController:vc animated:YES]; //跳转到下一页面
        
        
        UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        HLTzhanneixinTableViewController *vc = [storyBoard instantiateViewControllerWithIdentifier:@"HLTzhanneixinTableViewController"];
        
        [self.parent.navigationController pushViewController:vc animated:YES]; //跳转到下一页面
        
        
        
    } faliure:^(NSString *error) {
        
        
    }];

    
    
    
    
    
    
    
    
}
















@end
